package com.cn.lyl.util;

/**
 * 通用工具类
 */
public class Tool
{
    public static Integer stringToInt(String value) {
        try {
            return Integer.parseInt(value);
        } catch (Exception e) {

        }
        return 0;
    }

    public static Float stringToFloat(String value){

        try{
            return Float.parseFloat(value);
        }catch (Exception e){

        }
        return null;
    }

    public static String stringIsNotNull(String value){

        if(value == null){
            return "";
        }
        return value;
    }

    public static String stringIsNotNull(Object value){

        if(value == null){
            return "";
        }
        return (String)value;
    }
    public static String stringToNull(Object value){

        if(value == null){
            return null;
        }
        return (String)value;
    }


    public static Integer integerIsNotNull(Integer value){

        if(value == null){
            return 0;
        }
        return value;
    }

    public static Float floatIfNotNull(Object value){
        if(value == null){
            return 0.00f;
        }
        return (Float)value;
    }
    public static int curr(String value){
        try{
            return Integer.parseInt(value);
        } catch (Exception e) {

        }
        return 1;
    }
    public static int size(String value){
        try{
            return Integer.parseInt(value);
        } catch (Exception e) {

        }
        return 10;
    }
}
